package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	r := gin.Default()

	type userInfo struct {
		Username string `json:"a"`
		Age      int    `json:"b"`
	}

	r.GET("/:username", func(context *gin.Context) {
		var s userInfo
		err := context.ShouldBind(&s)
		if err != nil {
			fmt.Printf("绑定失败,err:%v", err)
			return
		}
		context.JSON(http.StatusOK, s)

	})
	r.Run(":9080")
}
